package zengqiang.day05.asda

fun main(args: Array<String>) {

    println(calc(1, 2, { m, n ->n + m })) //3
    println(calc(1, 2, { m, n ->n - m })) //1
    //如果最后一个参数是lambda表达式，则可以把逗号去掉，同时把）前移
    var r=calc(1, 2) { m, n ->n * m }
    println(r)//2
}


fun calc(a: Int, b: Int, block: (Int, Int) -> Int): Int {
    return block(a, b)
}
